package com.polytech.business;

import com.polytech.beans.Client;
import com.polytech.dao.ClientDao;

public class DefaultConnexionManager implements ConnexionManager {

	private ClientDao clientDao;
	@Override
	public boolean connect(String login, String password) {
		if(login.equals("admin") && password.equals("admin7"))
			return true;
		Client client = clientDao.select(login);
		if(client !=null && client.getEmail().equals(login) && client.getPassword().equals(password))
			return true;
		return false;
	}

	@Override
	public void singUp(Client client) {
		clientDao.insert(client);
	}

	public void setClientDao(ClientDao clientDao) {
		this.clientDao = clientDao;
	}
	

}
